<?php
/***
* @version $Id: admin_groups.php 336 2007-01-23 08:12:56Z flexiondotorg $
* @copyright (c) 2006 - 2007 Flexion.Org
*            (c) 2006              kkroo < princeomz2004@hotmail.com > (Omar Ramadan) http://phpbb-login.sourceforge.net
*            (c) 2006              Afterlife_69 < afterlife_69@hotmail.com > (Dean Newman) http://www.ugboards.com
*            (c) 2006 - 2007 damnian < damnian at phpbb dot cc > (Dmitry Shechtman) http://www.phpbb.cc
*            (c) 2004 - 2005 Project Minerva
*            (c) 2003             LifeIsPain <brian@orvp.net> (Brian Evans)
*            (c) 2001 - 2006 phpBB Group
* @license   http://opensource.org/licenses/gpl-license.php GNU Public License
***/

define('IN_R3BORN', true);

if ( !empty($setmodules) )
{
	$module['Groups']['Manage'] = basename(__FILE__);
	return;
}

//
// Load default header
//
$root_path = './../';
$phpEx = substr(strrchr(__FILE__, '.'),	1);

// Start add - Slick Group Admin MOD
$confirm = ( isset($_POST['confirm']) ) ? TRUE : FALSE;
$cancel = ( isset($_POST['cancel']) ) ? TRUE : FALSE;

$no_page_header = $cancel;
// End add - Slick Group Admin MOD

require('./pagestart.' . $phpEx);

// Start add - Slick Group Admin MOD
$confirm = ( isset($_POST['confirm']) ) ? TRUE : FALSE;
$cancel = ( isset($_POST['cancel']) ) ? TRUE : FALSE;
if ($cancel)
{
	redirect(append_sid("admin_groups.$phpEx"));
}
// End add - Slick Group Admin MOD

$group_id = get_var(POST_GROUPS_URL, 0);
$mode = get_var('mode', '');

### R3-born - ADD
#
    loadHooks(getHooks('group'));
#
### R3-born - END ADD

if ( $mode == 'edit' || isset($_POST['new']) )
{
	//
	// Ok they are editing a group or creating a new group
	//
	$template->set_filenames(array(
		'body' => 'group_edit_body.tpl')
	);

	if ($mode == 'edit')
	{
		//
		// They're editing. Grab the vars.
		//
		$sql = "SELECT *
			FROM " . GROUPS_TABLE . "
			WHERE group_single_user <> " . TRUE . "
			AND group_id = $group_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
		}

		if ( !($group_info = $db->sql_fetchrow($result)) )
		{
			message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
		}

		$mode = 'editgroup';
		$template->assign_block_vars('group_edit', array());

	}
	else if ( isset($_POST['new']) )
	{
		$group_info = array (
			'group_name' => '',
			'group_description' => '',
			'group_moderator' => '',
			'group_type' => GROUP_OPEN);
		$group_open = ' checked="checked"';

		$mode = 'newgroup';

	}

	//
	// Ok, now we know everything about them, let's show the page.
	//
	if ($group_info['group_moderator'] != '')
	{
		$sql = "SELECT user_id, username
			FROM " . USERS_TABLE . "
			WHERE user_id = " . $group_info['group_moderator'];
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
		}

		if ( !($row = $db->sql_fetchrow($result)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain user info for moderator list', '', __LINE__, __FILE__, $sql);
		}

		$group_moderator = $row['username'];
	}
	else
	{
		$group_moderator = '';
	}

	// SIMPLE COLORED USERGROUPS MOD START
	// Select the template data
	$templatedata = array();
	$sql = "SELECT themes_id AS style_id, template_name AS style_name FROM " . THEMES_TABLE . " ORDER BY template_name";
	if (! $result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, 'Unable to fetch styles data from database.', __LINE__, __FILE__, $sql);
	}
	while ( $row = $db->sql_fetchrow($result) )
	{
		$templatedata[] = $row;
	}
	$db->sql_freeresult($result);

	// Unserialize the group colors.
	$group_info['group_colors'] = unserialize($group_info['group_colors']);

	// Assign the template input boxs
	for ( $i = 0; $i < sizeof($templatedata); $i++ )
	{
		$template->assign_block_vars('styles_block', array(
			'STYLE_ID' => $templatedata[$i]['style_id'],
			'STYLE_NAME' => $templatedata[$i]['style_name'],
			'STYLE_COLOR' => $group_info['group_colors'][ $templatedata[$i]['style_id'] ],
		));
	}

	// Assign the order dropdown
	$template->assign_block_vars('group_row', array(
		'GROUP_ID' => 0,
		'GROUP_NAME' => $lang['color_groups_order_top'],
		'CHECKED' => ( $group_info['group_order'] - 1 == 0 ) ? 'selected="selected"' : '',
	));
	if ( is_array($color_groups['groupdata']) )
	{
		foreach ( $color_groups['groupdata'] AS $group_data )
		{
			$template->assign_block_vars('group_row', array(
				'GROUP_ID' => $group_data['group_id'],
				'GROUP_NAME' => '- ' . $group_data['group_name'],
				'CHECKED' => ( $group_info['group_order'] - 1 == $group_data['group_id'] ) ? 'selected="selected"' : '',
			));
		}
	}
	// COLOR GROUPS END

	$group_open = ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '';
	$group_closed = ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '';
	$group_hidden = ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '';
### R3-born - ADD (Auto Group)
#
	$group_auto = ( $group_info['group_type'] == GROUP_AUTO ) ? ' checked="checked"' : '';
#
### R3-born - END ADD


### R3-born - ADD
#
	$hooks->execute('editgroup-init-vars');
#
### R3-born - END ADD

	$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />';

### R3-born - ADD
#
	$hooks->execute('editgroup-add-hidden-vars');
#
### R3-born - END ADD


	$template->assign_vars(array(
		'GROUP_NAME' => $group_info['group_name'],
		'GROUP_DESCRIPTION' => $group_info['group_description'],
		'GROUP_MODERATOR' => $group_moderator,

		// SIMPLE COLORED USERGROUPS MOD START
		'L_COLOR_FOR' => $lang['color_groups_for'],
		'L_COLOR_FOR_EXPLAIN' => $lang['color_groups_for_explain'],
		'L_COLOR_GROUPS' => $lang['color_groups'],
		'L_COLOR_GROUPS_ON' => $lang['color_groups_on'],
		'L_COLOR_GROUPS_ORDER' => $lang['color_groups_order'],
		'S_COLOR_GROUPS_ON_CHECKED' => ( $group_info['group_colored'] ) ? 'checked="checked"' : '',
		'L_SEARCH_COLOR' => $lang['color_find'],
		'U_SEARCH_COLOR' => append_sid($root_path . "search." . $phpEx . "?mode=searchcolor"),
		'U_PICKER_JS' => $root_path . 'javascript/picker.js',
		// COLOR GROUPS END

		'L_GROUP_TITLE' => $lang['Group_administration'],
		'L_GROUP_EDIT_DELETE' => ( isset($_POST['new']) ) ? $lang['New_group'] : $lang['Edit_group'],
		'L_GROUP_NAME' => $lang['group_name'],
		'L_GROUP_DESCRIPTION' => $lang['group_description'],
		'L_GROUP_MODERATOR' => $lang['group_moderator'],
		'L_FIND_USERNAME' => $lang['Find_username'],
		'L_GROUP_STATUS' => $lang['group_status'],
		'L_GROUP_OPEN' => $lang['group_open'],
		'L_GROUP_CLOSED' => $lang['group_closed'],
		'L_GROUP_HIDDEN' => $lang['group_hidden'],
		'L_GROUP_DELETE' => $lang['group_delete'],
		'L_GROUP_DELETE_CHECK' => $lang['group_delete_check'],
		'L_SUBMIT' => $lang['Submit'],
		'L_RESET' => $lang['Reset'],
		'L_DELETE_MODERATOR' => $lang['delete_group_moderator'],
		'L_DELETE_MODERATOR_EXPLAIN' => $lang['delete_moderator_explain'],
		'L_YES' => $lang['Yes'],


		'U_SEARCH_USER' => append_sid("../search." . $phpEx . "?mode=searchuser"),
### R3-born - ADD (Auto Group)
#
		'L_GROUP_AUTO' => $lang['Group_auto'],
		'S_GROUP_AUTO_TYPE' => GROUP_AUTO,
		'S_GROUP_AUTO_CHECKED' => $group_auto,
#
### R3-born - END ADD
		'S_GROUP_OPEN_TYPE' => GROUP_OPEN,
		'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED,
		'S_GROUP_HIDDEN_TYPE' => GROUP_HIDDEN,
		'S_GROUP_OPEN_CHECKED' => $group_open,
		'S_GROUP_CLOSED_CHECKED' => $group_closed,
		'S_GROUP_HIDDEN_CHECKED' => $group_hidden,
		'S_GROUP_ACTION' => append_sid("admin_groups.$phpEx"),
		'S_HIDDEN_FIELDS' => $s_hidden_fields)
	);

### R3-born - ADD
#
	$hooks->execute('editgroup-display-options', $group_id);
#
### R3-born - END ADD


	$template->pparse('body');

}
else if ( isset($_POST['group_update']) || $mode == 'delete' )
{
	//
	// Ok, they are submitting a group, let's save the data based on if it's new or editing
	//
	if ( $mode == 'delete' )
	{
		// Start add - Slick Group Admin MOD
		if( !$confirm )
		{
			$hidden_fields = '<input type="hidden" name="mode" value="delete" /><input type="hidden" name="'.POST_GROUPS_URL.'" value="'.$group_id.'" />';

			//
			// Set template files
			//
			$template->set_filenames(array(
				'confirm' => 'confirm_body.tpl')
			);

			$template->assign_vars(array(
				'MESSAGE_TITLE' => $lang['Confirm'],
				'MESSAGE_TEXT' => $lang['Confirm_delete_group'],

				'L_YES' => $lang['Yes'],
				'L_NO' => $lang['No'],

				'S_CONFIRM_ACTION' => append_sid('admin_groups.' . $phpEx),
				'S_HIDDEN_FIELDS' => $hidden_fields)
			);

			$template->pparse('confirm');
		}
		else
		{
		// End add - Slick Group Admin MOD

			//
			// Reset User Moderator Level
			//

			// Is Group moderating a forum ?
			$sql = "SELECT auth_mod FROM " . USER_GROUP_AUTH_ACCESS_TABLE . "
				WHERE group_id = " . $group_id;
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not select auth_access', '', __LINE__, __FILE__, $sql);
			}

			$row = $db->sql_fetchrow($result);
			if (intval($row['auth_mod']) == 1)
			{
				// Yes, get the assigned users and update their Permission if they are no longer moderator of one of the forums
				$sql = "SELECT user_id FROM " . USER_GROUP_TABLE . "
					WHERE group_id = " . $group_id;
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Could not select user_group', '', __LINE__, __FILE__, $sql);
				}

				$rows = $db->sql_fetchrowset($result);
				for ($i = 0; $i < count($rows); $i++)
				{
					$sql = "SELECT g.group_id FROM " . USER_GROUP_AUTH_ACCESS_TABLE . " a, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
								WHERE (a.auth_mod = 1) AND (g.group_id = a.group_id) AND (a.group_id = ug.group_id) AND (g.group_id = ug.group_id)
								AND (ug.user_id = " . intval($rows[$i]['user_id']) . ") AND (ug.group_id <> " . $group_id . ")";
					if ( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not obtain moderator permissions', '', __LINE__, __FILE__, $sql);
					}

					if ($db->sql_numrows($result) == 0)
					{
						$sql = "UPDATE " . USERS_TABLE . " SET user_level = " . USER . "
									WHERE user_level = " . MOD . " AND user_id = " . intval($rows[$i]['user_id']);

						if ( !$db->sql_query($sql) )
						{
							message_die(GENERAL_ERROR, 'Could not update moderator permissions', '', __LINE__, __FILE__, $sql);
						}
					}
				}
			}

			// SIMPLE COLORED USERGROUPS MOD START
			$sql = "SELECT u.group_priority, u.user_id FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u
						WHERE ug.group_id = $group_id
						AND u.user_id = ug.user_id";
			if ( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could select group users.', '', __LINE__, __FILE__, $sql);
			}
			while ( $row = $db->sql_fetchrow($result) )
			{
				if ( $row['group_priority'] == $group_id )
				{
					$sql = 'UPDATE ' . USERS_TABLE . ' SET group_priority = 0 WHERE user_id = ' . $row['user_id'];
					if ( !$db->sql_query($sql) )
					{
						message_die(GENERAL_ERROR, 'Could not reset group priority.', '', __LINE__, __FILE__, $sql);
					}
				}
			}
			// COLOR GROUPS END

			//
			// Delete Group
			//
			$sql = "DELETE FROM " . GROUPS_TABLE . "
				WHERE group_id = " . $group_id;
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
			}

			$sql = "DELETE FROM " . USER_GROUP_TABLE . "
				WHERE group_id = " . $group_id;
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update user_group', '', __LINE__, __FILE__, $sql);
			}

			$sql = "DELETE FROM " . USER_GROUP_AUTH_ACCESS_TABLE . "
				WHERE group_id = " . $group_id;
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update auth_access', '', __LINE__, __FILE__, $sql);
			}

### R3-born - ADD
#
			$hooks->execute('delete_group', $group_id);
#
### R3-born - END ADD


			$message = $lang['Deleted_group'] . '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');

			message_die(GENERAL_MESSAGE, $message);
		// Start add - Slick Group Admin MOD
		}
		// End add - Slick Group Admin MOD
	}
	else
	{
		// SIMPLE COLORED USERGROUPS MOD START
		$group_colors = array();
		$templatedata = array();
		$sql = "SELECT themes_id AS style_id, template_name AS style_name FROM " . THEMES_TABLE . " ORDER BY template_name";
		if (! $result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, 'Unable to fetch styles data from database.', __LINE__, __FILE__, $sql);
		}
		while ( $row = $db->sql_fetchrow($result) )
		{
			$templatedata[] = $row;
		}
		$db->sql_freeresult($result);
		for ( $i = 0; $i < sizeof($templatedata); $i++)
		{
			$group_colors[ $templatedata[$i]['style_id'] ] = substr(htmlspecialchars($_POST[ 'color_' . $templatedata[$i]['style_id'] ]), 0, 6);
		}
		$group_colors = serialize($group_colors);
		$group_order = intval($_POST['color_group_order'] + 1);
		$group_colored_check = ( isset($_POST['group_colored']) ) ? 1 : 0;
		// COLOR GROUPS END

		$group_type = isset($_POST['group_type']) ? intval($_POST['group_type']) : GROUP_OPEN;
		$group_name = isset($_POST['group_name']) ? htmlspecialchars(trim($_POST['group_name'])) : '';
		$group_description = isset($_POST['group_description']) ? trim($_POST['group_description']) : '';
		$group_moderator = isset($_POST['username']) ? $_POST['username'] : '';
		$delete_old_moderator = isset($_POST['delete_old_moderator']) ? true : false;

### R3-born - ADD
#
		$hooks->execute('editgroup-get-vars',$group_id);
#
### R3-born - END ADD

		if ( $group_name == '' )
		{
			message_die(GENERAL_MESSAGE, $lang['No_group_name']);
		}
		else if ( $group_moderator == '' )
		{
			message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
		}

		$this_userdata = get_userdata($group_moderator, true);
		$group_moderator = $this_userdata['user_id'];

		if ( !$group_moderator )
		{
			message_die(GENERAL_MESSAGE, $lang['No_group_moderator']);
		}

		if( $mode == "editgroup" )
		{
			$sql = "SELECT *
				FROM " . GROUPS_TABLE . "
				WHERE group_single_user <> " . TRUE . "
				AND group_id = " . $group_id;
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql);
			}

			if( !($group_info = $db->sql_fetchrow($result)) )
			{
				message_die(GENERAL_MESSAGE, $lang['Group_not_exist']);
			}

			if ( $group_info['group_moderator'] != $group_moderator )
			{
				if ( $delete_old_moderator )
				{
					$sql = "DELETE FROM " . USER_GROUP_TABLE . "
						WHERE user_id = " . $group_info['group_moderator'] . "
							AND group_id = " . $group_id;
					if ( !$db->sql_query($sql) )
					{
						message_die(GENERAL_ERROR, 'Could not update group moderator', '', __LINE__, __FILE__, $sql);
					}

					// SIMPLE COLORED USERGROUPS MOD START
					if ( $this_userdata['group_priority'] == $group_id )
					{
						$sql = "UPDATE " . USERS_TABLE . " SET group_priority = 0 WHERE user_id = $group_moderator";
						if ( !$db->sql_query($sql) )
						{
							message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);
						}
					}
					// COLOR GROUPS END
				}

				$sql = "SELECT user_id
					FROM " . USER_GROUP_TABLE . "
					WHERE user_id = $group_moderator
						AND group_id = $group_id";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(GENERAL_ERROR, 'Failed to obtain current group moderator info', '', __LINE__, __FILE__, $sql);
				}

				if ( !($row = $db->sql_fetchrow($result)) )
				{
					$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
						VALUES (" . $group_id . ", " . $group_moderator . ", 0)";
					if ( !$db->sql_query($sql) )
					{
						message_die(GENERAL_ERROR, 'Could not update group moderator', '', __LINE__, __FILE__, $sql);
					}
				}
			}
### R3-born - CHANGE (Color Groups)
#
/*
			$sql = "UPDATE " . GROUPS_TABLE . "
				SET group_type = $group_type, group_name = '" . str_replace("\'", "''", $group_name) . "', group_description = '" . str_replace("\'", "''", $group_description) . "', group_moderator = $group_moderator
				WHERE group_id = $group_id";
*/
			$sql = "UPDATE " . GROUPS_TABLE . "
				SET group_type = $group_type, group_name = '" . str_replace("\'", "''", $group_name) . "', group_description = '" . str_replace("\'", "''", $group_description) . "', group_moderator = $group_moderator, group_colored = '$group_colored_check', group_colors = '$group_colors', group_order = '$group_order'
				WHERE group_id = $group_id";
#
### R3-born - END CHANGE
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update group', '', __LINE__, __FILE__, $sql);
			}

### R3-born - ADD
#
			$hooks->execute('editgroup-update-vars', $group_id);
#
### R3-born - END ADD

			$message = $lang['Updated_group'] . '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;

			message_die(GENERAL_MESSAGE, $message);
		}
		else if( $mode == 'newgroup' )
		{
### R3-born - CHANGE (Color Groups)
#
//			$sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user)
//				VALUES ($group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator,	'0')";
#
### R3-born - END ADD
			$sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user, group_colored, group_colors, group_order)
				VALUES ($group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator,	'0', '$group_colored_check', '$group_colors', '$group_order')";


			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert new group', '', __LINE__, __FILE__, $sql);
			}
			$new_group_id = $db->sql_nextid();

			$sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
				VALUES ($new_group_id, $group_moderator, 0)";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);
			}

			$message = $lang['Added_new_group'] . '<br /><br />' . sprintf($lang['Click_return_groupsadmin'], '<a href="' . append_sid("admin_groups.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');;

			message_die(GENERAL_MESSAGE, $message);

		}
		else
		{
			message_die(GENERAL_MESSAGE, $lang['No_group_action']);
		}
	}
}
else
{
	$sql = "SELECT group_id, group_name, group_description
		FROM " . GROUPS_TABLE . "
		WHERE group_single_user <> " . TRUE . "
		ORDER BY group_name";
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not obtain group list', '', __LINE__, __FILE__, $sql);
	}

	/*$select_list = '';
	if ( $row = $db->sql_fetchrow($result) )
	{
		$select_list .= '<select name="' . POST_GROUPS_URL . '">';
		do
		{
			$select_list .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
		}
		while ( $row = $db->sql_fetchrow($result) );
		$select_list .= '</select>';
	}*/

	// Start add - Slick Group Admin MOD
	while ( $row = $db->sql_fetchrow($result) )
	{
		$group_id = $row['group_id'];

		$template->assign_block_vars('group', array(
			"GROUP_NAME" => $row['group_name'],
			"GROUP_DESCRIPTION" => $row['group_description'],

			"U_GROUP_VIEW" => append_sid("../groupcp.$phpEx?" . POST_GROUPS_URL . '=' . $group_id),
			"U_GROUP_EDIT" => append_sid("admin_groups.$phpEx?mode=edit&" . POST_GROUPS_URL . '=' . $group_id),
			//"U_GROUP_PERMISSIONS" => append_sid("admin_ug_auth.$phpEx?mode=group&" . POST_GROUPS_URL . '=' . $group_id),
			"U_GROUP_DELETE" => append_sid("admin_groups.$phpEx?mode=delete&" . POST_GROUPS_URL . '=' . $group_id))
		);
	}

	$db->sql_freeresult($result);
	// End add - Slick Group Admin MOD
	// Slick Group Admin MOD: 11 lines removed

	$template->set_filenames(array(
		'body' => 'group_admin_body.tpl')
	);

	$template->assign_vars(array(
		'L_GROUP_TITLE' => $lang['Group_administration'],
		'L_GROUP_EXPLAIN' => $lang['Group_admin_explain'],
		//'L_GROUP_SELECT' => $lang['Select_group'],
		//'L_LOOK_UP' => $lang['Look_up_group'],
		// Start add - Slick Group Admin MOD
		'L_EDIT' => $lang['Edit'],
		//'L_PERMISSIONS' => getModuleDependency('forum') ? $lang['Permissions'] : '',
		'L_DELETE' => $lang['Delete'],
		// End add - Slick Group Admin MOD
		// Slick Group Admin MOD: 2 lines removed
		'L_CREATE_NEW_GROUP' => $lang['New_group'],

		'S_GROUP_ACTION' => append_sid("admin_groups.$phpEx"),
		//'S_GROUP_SELECT' => $select_list
		)
	);

	// Slick Group Admin MOD: 3 lines removed
	/*if ( $select_list != '' )
	{
		$template->assign_block_vars('select_box', array());
	}*/
	// Slick Group Admin MOD: 3 lines removed

	$template->pparse('body');
}

page_footer_admin();

?>